import {BASE_URL} from './config'
export const chooseImage=(count=9,sizeType=['original', 'compressed'],sourceType=["album","camera"])=>{
	
	return new Promise((resovle,reject)=>{
		
		
		uni.chooseImage({
			count,
			sizeType,
			sourceType,
			success: function (res) {
				
				resovle(res.tempFilePaths);
 
			}
		});


		
	})
	
}

export const uploadFile=(tempFilePaths,formData={})=>{
	
	
	return new Promise((resovle,reject)=>{
		uni.uploadFile({
					url: BASE_URL+'/upload/add', //仅为示例，非真实的接口地址
					filePath: tempFilePaths,
					name: 'file',
					header:{
						Authorization:uni.getStorageSync("token")
					},
					formData,
					success: (uploadFileRes) => {
						
						resovle(JSON.parse(uploadFileRes.data));
						
					}
				});
	})
	
}